package com.scau.service.impl;

import com.scau.dao.CompanyInfoMapper;
import com.scau.pojo.CompanyInfo;
import com.scau.service.ICompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *  公司信息服务实现，增删改查
 *
 * Siaoja
 */
@Service
public class CompanyInfoServiceImpl implements ICompanyInfoService {

    @Autowired
    private CompanyInfoMapper companyInfoMapper;

    @Override
    public CompanyInfo getCompanyInfo(String username) {
        /*CompanyInfoExample companyInfoExample = new CompanyInfoExample();
        companyInfoExample.createCriteria().andUsernameEqualTo(companyInfo.getUsername());

        List<CompanyInfo> companyInfo = companyInfoMapper.selectByExample(companyInfoExample);*/
        CompanyInfo companyInfo = companyInfoMapper.selectByPrimaryKey(username);
        return companyInfo;
    }

    @Override
    public List<CompanyInfo> getCompanyInfos() {

        return null;
    }

    @Override
    public int addCompanyInfo(CompanyInfo companyInfo) {
        int rows;
        //添加事务管理
        rows = companyInfoMapper.insert(companyInfo);
        return rows;
    }

    @Override
    public int updateCompanyInfo(CompanyInfo companyInfo) {
        int rows;
        //添加事务管理
        rows = companyInfoMapper.updateByPrimaryKey(companyInfo);

        return rows ;
    }

    @Override
    public CompanyInfo deleteCompanyInfo(CompanyInfo companyInfo) {
        return null;
    }
}
